home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / dropde-2.zip / FLAME.QC < prev    next >
Text File  |  1996-09-17  |  5KB  |  204 lines

  1. /*
  2. ============================================================================
  3.  
  4. Quake Flamethrower 1.0
  5.  
  6. Another groovy patch from Quake Command - http://www.nuc.net/quake
  7.  
  8. QC Code By : Steve Bond     wedge@nuc.net
  9.  
  10. Apologies in advance... I was unable to comment this as well as I'd have
  11. liked to. (I used some weird variable names - hope they don't cause problems.
  12.  
  13. ============================================================================
  14. */
  15.  
  16. // Internal declaration
  17.     void (vector fireorg) SpawnTouchFlame;
  18.     void () BurnThem;
  19.  
  20. // Player.qc declaration
  21.     void () DeathBubblesSpawn;
  22.  
  23.  
  24.  
  25. // Slightly varied version of DEATHBUBBLES
  26. void(float num_bubbles, vector bub_origin) NewBubbles =
  27. {
  28.     local entity bubble_spawner;
  29.     
  30.     bubble_spawner = spawn();
  31.     setorigin (bubble_spawner, bub_origin);
  32.     bubble_spawner.movetype = MOVETYPE_NONE;
  33.     bubble_spawner.solid = SOLID_NOT;
  34.     bubble_spawner.nextthink = time + 0.1;
  35.  
  36.     if (self.classname == "player")
  37.         bubble_spawner.owner = self;
  38.     else
  39.         bubble_spawner.owner = self.firelink;
  40.  
  41.     bubble_spawner.think = DeathBubblesSpawn;
  42.     bubble_spawner.bubble_count = num_bubbles;
  43.     return;
  44. };
  45.  
  46.  
  47. /*
  48. ===============
  49. Burn Them!
  50. ===============
  51. */
  52. void () BurnThem =
  53. {
  54.     local entity wood;
  55.     wood = self.firelink;
  56.     if ( !(wood.flags & FL_ONFIRE) )
  57.     {
  58.         wood.effects = wood.effects - (wood.effects & EF_DIMLIGHT);
  59.         sound(wood, CHAN_FIRE, "hknight/hit.wav", 0.5, ATTN_NORM);
  60.         remove(self);
  61.     }
  62.     else if (wood.waterlevel >= 1)
  63.     {
  64.         NewBubbles(6, wood.origin);
  65.         sound (wood, CHAN_FIRE, "misc/water2.wav", 1, ATTN_NORM);
  66.         wood.effects = wood.effects - EF_DIMLIGHT;
  67.         wood.flags = wood.flags - FL_ONFIRE;
  68.         remove(self);
  69.     }
  70.     else
  71.     {
  72.         local vector org;
  73.         org = wood.origin;
  74.         org_z = org_z + ((wood.maxs_z + wood.mins_z) * 0.5) - 2;
  75.         SpawnTouchFlame(org);
  76.         if (wood.classname == "monster_demon1")
  77.             T_Damage (wood, self, self.owner, 0.5);
  78.         else
  79.             T_Damage (wood, self, self.owner, 1);
  80.         self.nextthink = time + 0.25;
  81.     }
  82. };
  83.  
  84.  
  85. /*
  86. ================
  87. SpawnTouchFlame
  88. ================
  89. */
  90.  
  91. void (vector fireorg) SpawnTouchFlame =
  92. {
  93.     local entity flame;
  94.     flame = spawn ();
  95.     flame.owner = self;
  96.     flame.movetype = MOVETYPE_FLYMISSILE;
  97.     flame.velocity = '0 0 75';
  98.     flame.solid = SOLID_NOT;
  99.     flame.classname = "fire";
  100.     flame.origin = fireorg;
  101.     flame.think = s_explode1;
  102.     flame.nextthink = time;
  103.     setmodel (flame, "progs/s_explod.spr");
  104.     setsize (flame, '0 0 0', '0 0 0');        
  105. };
  106.  
  107. /*
  108. ================
  109. FlameTouch
  110. ================
  111. */
  112. void () FlameTouch =
  113. {
  114.     if (other == self.owner)
  115.         return;
  116.  
  117.     if (other.takedamage)
  118.     {
  119.         local vector org;
  120.         org = other.origin;
  121.         org_z = org_z + ((other.maxs_z + other.mins_z) * 0.5) - 2;
  122.         SpawnTouchFlame(org);
  123.         if (other.classname == "monster_demon1")
  124.             T_Damage (other, self, self.owner, 4);
  125.         else
  126.             T_Damage (other, self, self.owner, 8);
  127.  
  128.         // If target not gibbed or on fire, 20% chance of catching fire.
  129.         if (other.takedamage && !(other.flags & FL_ONFIRE) && random() < 0.2)
  130.         {
  131.             // Fire stays with whatever it hits
  132.             if (other.classname == "player")
  133.             {
  134.                 centerprint(other,"You are on fire! Find WATER!\n");
  135.                 stuffcmd (other,"bf\n");
  136.             }
  137.             other.flags = other.flags | FL_ONFIRE;
  138.             sound(other, CHAN_FIRE, "ambience/fire1.wav", 0.75, ATTN_STATIC);
  139.             self.firelink = other;
  140.             self.think = BurnThem;
  141.             self.nextthink = time;
  142.             self.solid = SOLID_NOT;
  143.             setmodel (self,"");
  144.             other.effects = other.effects | EF_DIMLIGHT;
  145.         }
  146.         else
  147.             remove (self);
  148.     }
  149.     else if (other == world)
  150.     {
  151.         self.velocity = '0 0 0';
  152.     }
  153. };
  154.  
  155. /*
  156. ================
  157. W_FireFlame
  158. ================
  159. */
  160. void() W_FireFlame =
  161. {
  162.     local entity flame;
  163.  
  164.     if (self.waterlevel > 2)
  165.     {
  166.         makevectors (self.v_angle);
  167.         NewBubbles(2, self.origin+v_forward*64);
  168.  
  169.         if (random() < 0.5)
  170.             sound (self, CHAN_WEAPON, "misc/water1.wav", 1, ATTN_NORM);
  171.         else
  172.             sound (self, CHAN_WEAPON, "misc/water2.wav", 1, ATTN_NORM);
  173.  
  174.         return;
  175.     }
  176.  
  177.     // Take away a little rocket fuel
  178.     self.currentammo = self.ammo_rockets = self.ammo_rockets - 0.2;
  179.  
  180.     sound (self, CHAN_WEAPON, "hknight/hit.wav", 1, ATTN_NORM);
  181.  
  182.     flame = spawn ();
  183.     flame.owner = self;
  184.     flame.movetype = MOVETYPE_FLYMISSILE;
  185.     flame.solid = SOLID_BBOX;
  186.     flame.classname = "fire";
  187.         
  188. // set flame speed    
  189.  
  190.     makevectors (self.v_angle);
  191.  
  192.     flame.velocity = aim(self, 10000);
  193.     flame.velocity = flame.velocity * 300;
  194.  
  195.     flame.touch = FlameTouch;
  196.     
  197.     flame.think = s_explode1;
  198.     flame.nextthink = time + 0.15;
  199.  
  200.     setmodel (flame, "progs/s_explod.spr");
  201.     setsize (flame, '0 0 0', '0 0 0');        
  202.     setorigin (flame, self.origin + v_forward * 16 + '0 0 16');
  203. };
  204.